package com.free.chat.web;

import com.free.chat.entity.ApiResult;
import com.free.chat.entity.dto.UserFriendDTO;
import com.free.chat.service.UserRelationService;
import io.swagger.annotations.Api;
import org.noear.solon.annotation.*;
import org.noear.solon.validation.annotation.Valid;

@Valid
@Controller
@Mapping("userRelation")
@Api(tags = "用户关系接口")
public class UserRelationController {

    @Inject
    private UserRelationService userRelationService;

    /**
     * 添加好友
     *
     * @param userFriendDTO 用户
     */
    @Post
    @Mapping("saveFriend")
    public ApiResult saveFriend(UserFriendDTO userFriendDTO) {
        return userRelationService.saveFriend(userFriendDTO);
    }

    /**
     * 删除好友
     *
     * @param userFriendDTO 用户
     */
    @Get
    @Mapping("deleteFriend")
    public ApiResult deleteFriend(UserFriendDTO userFriendDTO) {
        return userRelationService.deleteFriend(userFriendDTO);
    }
}
